﻿using System;
using System.Collections.Generic;

namespace BookiFramework.Abstracts
{
    public class OperationResult
    {
        public OperationResult()
        {
            this.Messages = new List<string>();
        }
        public bool IsCorrect { get; private set; }
        public List<string> Messages { get; set; }

        public static OperationResult Correct(string message = null)
        {
            var op = new OperationResult() { IsCorrect = true };
            if (message != null)
                op.Messages.Add(message);
            return op;
        }

        public static OperationResult Fail(string message = null)
        {
            var op = new OperationResult() { IsCorrect = false };
            if (message != null)
                op.Messages.Add(message);
            return op;
        }

        public static OperationResult Fail(IEnumerable<String> messages = null)
        {
            var op = new OperationResult() { IsCorrect = false };
            if (messages != null)
                op.Messages.AddRange(messages);
            return op;
        }
    }

}
